#!/bin/sh
executeDir=$(cd "$(dirname "$0")";pwd)
pid=""
chmod -R 0777 /root/go/src/awesomeTask
if [ -f ${executeDir}/awesomeTask.pid ];then
  pid=$(cat ${executeDir}/awesomeTask.pid)
  rm -rf ${executeDir}/awesomeTask.pid
  kill -15 ${pid}
fi
cd ${executeDir}
go build
./awesomeTask > ./awesomeTask.log &
newPid=$!
echo "$newPid" > ./awesomeTask.pid